package sat.model;

import java.util.List;

import sat.component.ClassComponent;

public class ClassModel {
	private String name;
	private List<String> attributList;
	private List<String> operationList;
	
	private ClassComponent view; 
	
	public ClassComponent getView() {
		return view;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	public List<String> getAttributList() {
		return attributList;
	}
	public void setAttributList(List<String> attributList) {
		this.attributList = attributList;
	}
	
	public List<String> getOperationList() {
		return operationList;
	}
	public void setOperationList(List<String> operationList) {
		this.operationList = operationList;
	}
	
	public String ListStringToString(List<String> ls){
		String res = "";
		for (int i = 0; i < ls.size(); i++) {
			res += ls.get(i)+" \n";
			System.out.println("ls.get(i) = "+ls.get(i));
		}
		return res;
	}
	
	
	
	public ClassModel (ClassComponent cmp){
		view = cmp; 
	}
	
	public void refreshModel(String name, List<String> attList,  List<String> operList){
		this.name = name;
		this.attributList= attList;
		this.operationList = operList;
		view.refreshView(this.name, ListStringToString(attributList),ListStringToString(operationList));
	}
	
	public void refreshModel(String name, List<String> operList){
		this.name = name;
		this.operationList = operList;
		view.refreshView(this.name, ListStringToString(operationList));
	}
	

}
